<!DOCTYPE html> 
<html lang="en"> 
  <head> 
    <meta charset="utf-8"> 
    <title>RestRpc Dashboard</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content=""> 
    <meta name="author" content=""> 
 
    <!-- Le styles --> 
    <link href="../css/bootstrap.min.css" rel="stylesheet"> 
    <link href="../css/bootstrap-responsive.min.css" rel="stylesheet"> 
    <link href="../css/docs.css" rel="stylesheet"> 
    <link href="../css/common.css" rel="stylesheet"> 

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> 
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]--> 

  </head> 
 
  <body data-spy="scroll" data-target=".bs-docs-sidebar"> 

 
  <div class="container"> 
 
    <div class="row"> 
      <div class="span3 bs-docs-sidebar">
      </div>
     
      <div class="span9"> 
        <section > 
          <div class="page-header">
            <h1>RpcProxy Instance Detail</h1>
          </div>

          <div class="row-fluid">
            <p>RpcOptions </p>
            <table id="options" class="table table-bordered  table-striped">
				<thead>
				<tr>
				<th width='50%'>Name</th>
				<th>Value</th>
				</tr>
				</thead>
				<tbody>
				</tbody>
   			</table>
   			
          </div>
        </section> 
 
      </div> 
    </div> 
 
  </div> 
 
<script type="text/javascript" src="../js/jquery.min.js"></script> 
<script type="text/javascript" src="../js/common.js"></script> 
<script type="text/javascript" src="client.js"></script> 
<script type="text/javascript" >
$(document).ready(function() {
	$.ajax({
		type: "GET",
		url: "rpcProxyDetail.json",
		dataType: "json",
		data:restrpc.dashboard.windowLocationSearch(),
		success:function(json) {
	   		if (!json.succeed) {
	   			alert(json.message);
	   			return;
	   		}
	
	   		var tbody = $("#options tbody");
    		for (var p in json.data.rpcOptions) {
	    		tbody.append("<tr><td>"+p+"</td><td>"+json.data.rpcOptions[p]+"</td></tr>");
	    	}

    		for (var p in json.data.metadatas) {
        		var metadata = json.data.metadatas[p];
    			$('.row-fluid').append('<p>ServiceName:'+metadata.serviceName+'</p>');
    			var table = $('<table id="definition" class="table table-bordered  table-striped"> '+
					'<thead>'+
					'<tr>'+
					'<th width="50%">Name</th>'+
					'<th>Value</th>'+
					'</tr>'+
					'</thead>'+
					'<tbody>'+
					'</tbody>'+
	   				'</table>');
	    		
	    		var defPack = metadata.serviceDefinitionPack;
	    		for (var p in defPack) {
		    		if (p == 'remoteServiceDefinitions' ) {
			    		var s = "<tr><td>"+p+"</td><td>";

						var defs = defPack[p];
						for (var i =0,length = defs.length;i<length;i++) {
							var def = defs[i];
							s += '<table id="definition" class="table table-bordered  table-striped"> '+
							'<thead>'+
							'<tr>'+
							'<th width="50%">Name</th>'+
							'<th>Value</th>'+
							'</tr>'+
							'</thead>'+
							'<tbody>';
							for (var defP in def) {
								s += "<tr><td>"+defP+"</td><td>"+def[defP]+"</td></tr>";
							}
							s += '</tbody>'+ 
							'</table>';
						}

						s += "</td></tr>";
		    			table.find('tbody').append(s);
			    	}
		    		else {
		    			table.find('tbody').append("<tr><td>"+p+"</td><td>"+defPack[p]+"</td></tr>");
			    	}
		    	}
		    	$('.row-fluid').append(table);
	    	}

		}
	});
});
</script> 
  </body> 
</html> 